import 'package:flutter/material.dart';
import 'package:keyboard_actions/keyboard_actions.dart';

KeyboardActionsConfig getKeyboardActionsConfig(
    BuildContext context, List<FocusNode> list) {
  return KeyboardActionsConfig(
    keyboardBarColor: Theme.of(context).canvasColor,
    nextFocus: true,
    actions: List.generate(
      list.length,
      (i) => KeyboardActionsItem(
        focusNode: list[i],
        toolbarButtons: [
          (node) {
            return GestureDetector(
              onTap: () => node.unfocus(),
              child: Padding(
                padding: EdgeInsets.only(right: 16.0),
                child: const Text('关闭'),
              ),
            );
          },
        ],
      ),
    ),
  );
}
